layui.config({
    base: '/layui/extend/'
}).use(['table', 'element', 'form', 'dtree', 'tablePlug'], function () {
    var table = layui.table;
    var $ = layui.$;
    var form = layui.form;
    var dtree = layui.dtree;
    var tablePlug = layui.tablePlug;

    tablePlug.smartReload.enable(true);


    var tableIns = table.render({
        elem: '#project-table',
        url: '/project/viewProject?userId='+userId,
        toolbar: '#toolbar',
        cellMinWidth : 95,
        smartReloadModel: true,
        page: true,
        id: "projectListTable",
        limits : [5,10,15,20,25],
        limit : 5,
        cols : [[
            {type: "checkbox", fixed:"left", width:50,align:'center'},
            {field: "id", title:'编号',fixed:"true", width:80},
            {field: 'leader', title: '项目负责人', align:"center"},
            {field: 'projectName', title: '项目名称', align:"center"},
            {field: 'createTime', title: '项目创建时间',align:'center'},
            {field: 'memberList', title: '项目成员', align:'center'},
            {field: 'detail', fixed: 'right', title: '项目需求描述', align:'center',minWidth:150},
            // {title: '操作', fixed: 'right', align: 'center', toolbar: '#column-toolbar'}
        ]]
    });

    //条件搜索按钮
    $(".search_btn").on("click", function (){
        console.log($("input[name='projectName']").val());
        table.reload("projectListTable", {
            page: {
                curr:1
            },
            where:{
                projectName: $("input[name='projectName']").val(),  //用户名
            }
        })
    })


    form.on('submit(search)', function (form) {
        table.reload('project-table', {
            where: form.field
        });
        return false;
    });

});